phrase = "Don't panic!"
plist = list(phrase)
print(phrase)
print(plist)
# 删除首个字符、单引号和后四个字符
plist.pop(0)
plist.remove("'")
for i in range(4):
    plist.pop()
# 调整字符顺序
# extend()函数用于在列表末尾一次性追加另一个序列中的多个值（用新列表扩展原来的列表）
plist.extend([plist.pop(), plist.pop()])
plist.insert(2, plist.pop(3))
# 转换回字符串
new_phrase = ''.join(plist)
print(plist)
print(new_phrase)


phrase = "Don't panic!"
plist = list(phrase)
print(phrase)
print(plist)
# 使用切片（切片是非破坏性的）
new_phrase = ''.join(plist[1:3])
new_phrase = ''.join([new_phrase, plist[5], plist[4], plist[7], plist[6]])
print(plist)
print(new_phrase)


phrase = "Don't panic!"
plist = list(phrase)
print(phrase)
print(plist)
new_phrase = ''.join(plist[1:3]) + ''.join([plist[5], plist[4], plist[7], plist[6]])
print(plist)
print(new_phrase)
